package com.dyh.quickdemozwei.protect;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: yhdong
 * @Date: 2021/9/18 10:16
 */
@RestController
@RequestMapping("/foo")
public class FooUpdateController {

    @Autowired
    FooUpdateService updateService;

    @RequestMapping("/update")
    public Object update(){
        return updateService.update();
    }

    @RequestMapping("/open")
    public void open(){
         RamOnlyConfig.set("updateProtect",false);
    }

    @RequestMapping("/onOff")
    public void onOff(){
        boolean old = (boolean)RamOnlyConfig.get("updateProtect");
        RamOnlyConfig.set("updateProtect",!old);
    }


}
